package org.example.java.socket.TCP;

import java.io.DataOutputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class Server2 {

    public static void main(String[] args) throws Exception {
        ServerSocket server = new ServerSocket(6666);
        System.out.println("=====服务器运行，等待客户连接=====");
//		while (true) {
        Socket client = server.accept();
        System.out.println(" a client is connect!");
        DataOutputStream dos = new DataOutputStream(client.getOutputStream());
        dos.writeUTF("hello!");
        dos.flush();
        dos.close();
        client.close();
//		}
    }

}
